package ${implPackage};

import org.springframework.stereotype.Service;
import ${servicePackage}.${serviceName};
import ${entityPackage}.${entityName};
import ${mapperPackage}.${mapperName};
<#if enableLombok>
import lombok.RequiredArgsConstructor;
</#if>

/**
* ${tableComment}(table: ${tableName}) 接口实现
* @author ${author}
* @since ${date}
*/
@Service
<#if enableLombok>
@RequiredArgsConstructor
</#if>
public class ${implName} implements ${serviceName}{

    private final ${mapperName} ${mapperName?uncap_first};

<#if !enableLombok>
    public ${implName}(${mapperName} ${mapperName?uncap_first}){
        this.${mapperName?uncap_first} = ${mapperName?uncap_first};
    }

</#if>
    /**
     * 插入新数据
     * @author ${author}
     * @since ${date}
     * @param entity:
     * @return ${entityPackage}.${entityName}
    */
    @Override
    public ${entityName} insert(${entityName} entity){
        ${mapperName?uncap_first}.insert(entity);
        return entity;
    }

<#if primaryColumn?? && (primaryColumn?size == 1)>
    /**
     * 根据ID删除记录
     * @author ${author}
     * @since ${date}
     * @param id:
    */
    @Override
    public void deleteById(Object id){
        ${mapperName?uncap_first}.deleteById(id);
    }

    /**
     * 根据ID更新记录
     * @author ${author}
     * @since ${date}
     * @param param:
    */
    @Override
    public void updateById(${entityName} param){
        ${mapperName?uncap_first}.updateById(param);
    }

    /**
     * 根据ID选择性更新
     * @author ${author}
     * @since ${date}
     * @param param:
    */
    @Override
    public void updateSelectiveById(${entityName} param){
        ${mapperName?uncap_first}.updateSelectiveById(param);
    }

    /**
     * 根据ID查询记录
     * @author ${author}
     * @since ${date}
     * @param id:
     * @return ${entityPackage}.${entityName}
    */
    @Override
    public ${entityName} selectById(Object id){
        return ${mapperName?uncap_first}.selectById(id);
    }

</#if>

}

